package com.wty.gw.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wty.gw.util.PageParamReq;
import com.wty.gw.dao.MessageMapper;
import com.wty.gw.model.Do.MessageDO;
import com.wty.gw.model.query.MessageQuery;
import com.wty.gw.service.MessageService;
import com.wty.gw.model.vo.MessageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class MessageServiceImpl implements MessageService{

	@Autowired
    private MessageMapper messageMapper;

    @Override
    public void add(MessageDO messageDo) {
        messageMapper.insert(messageDo);
    }

    @Override
    public void delete(Long id) {
        messageMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(MessageDO messageDo) {
        messageMapper.updateByPrimaryKeySelective(messageDo);
    }

    @Override
    public PageInfo<MessageVo> listByPage(MessageQuery messageQuery) {
        PageHelper.startPage(messageQuery.getPageNo(), messageQuery.getPageSize());

        return new PageInfo(messageMapper.listBycompanyId(messageQuery));
    }

    @Override
    public MessageDO get(Long id) {
        return messageMapper.selectByPrimaryKey(id);
    }
	
	
	
	
	
	
}